// rdsexam
package main

import (
	"fmt"
	"log"
	"sort"
	"strings"
	"time"

	"github.com/go-redis/redis"
)

func main() {
	fmt.Println("Hello World!")
	opt := &redis.Options{
		Addr:     "ryc.liuyanli.win:55270",
		Password: "adm#270@rds4rtd",
		DB:       0,
	}
	rds := redis.NewClient(opt)
	var cache string
	for _ = range time.NewTicker(time.Second).C {
		keys, err := rds.SMembers("glrtd_keys").Result()
		if err != nil {
			log.Println("Err:", err.Error())
		} else {
			sort.Strings(keys)
			ks := strings.Join(keys, ",")
			if strings.EqualFold(cache, ks) {
				log.Println(len(keys))
			} else {
				log.Println(len(keys), ks)
				cache = ks
			}
		}
	}
}
